package valueObject;

import entity.Course;
import entity.Professor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;

/**
 *
 * @author Juan Hernández Serrato
 */
public class ProfessorVO implements ValueObject<Professor> {
    private String userName;
    private String name;
    private String surname;
    private String description;
    private String web;
    private Date joinDate;
    private String studyLevel;
    private String email;
    private String nationality;
    private byte[] image;
    private Collection<CourseVO> courses;
    private UniversityVO university;
    
    public String getUserName() {
        return userName;
    }

    public void setUserName(String professorUser) {
        this.userName = professorUser;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getWeb() {
        return web;
    }

    public void setWeb(String web) {
        this.web = web;
    }

    public Date getJoinDate() {
        return joinDate;
    }

    public void setJoinDate(Date joinDate) {
        this.joinDate = joinDate;
    }

    public String getStudyLevel() {
        return studyLevel;
    }

    public void setStudyLevel(String studyLevel) {
        this.studyLevel = studyLevel;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getNationality() {
        return nationality;
    }

    public void setNationality(String nationality) {
        this.nationality = nationality;
    }

    public byte[] getImage() {
        return image;
    }

    public void setImage(byte[] image) {
        this.image = image;
    }

    public Collection<CourseVO> getCourses() {
        return courses;
    }

    public void setCourses(Collection<CourseVO> courseCollection) {
        this.courses = courseCollection;
    }

    public UniversityVO getUniversity() {
        return university;
    }

    public void setUniversity(UniversityVO universityuserUniversity) {
        this.university = universityuserUniversity;
    }

    @Override
    public Professor toEntity() {
        Professor professor = new Professor();
        ArrayList<Course> coursesE = new ArrayList<Course>();
        if(courses != null){
            for(CourseVO c : courses){
                coursesE.add(c.toEntity());
            }
        }
        professor.setCourseCollection(coursesE);
        professor.setDescription(description);
        professor.setEmail(email);
        professor.setImage(image);
        professor.setJoinDate(joinDate);
        professor.setName(name);
        professor.setNationality(nationality);
        professor.setProfessorUser(userName);
        professor.setStudyLevel(studyLevel);
        professor.setSurname(surname);
        professor.setUniversityuserUniversity(university.toEntity());
        professor.setWeb(web);
        return professor;
    }
}
